home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue50 / IPC / Messages / ChildMainFormUnit.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-08-31  |  854 b   |  37 lines

  1. unit ChildMainFormUnit;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls;
  8.  
  9. type
  10.   TChildForm = class(TForm)
  11.     Memo1: TMemo;
  12.     procedure Memo1Change(Sender: TObject);
  13.   private
  14.   end;
  15.  
  16. var
  17.   ChildForm: TChildForm;
  18.  
  19. implementation
  20.  
  21. {$R *.DFM}
  22.  
  23. procedure TChildForm.Memo1Change(Sender: TObject);
  24. var
  25.   CopyData: TCopyDataStruct;
  26.   TextMsg: String;
  27. begin
  28.   TextMsg := Memo1.Text;
  29.   //Make the data pointer point at the first character of the string
  30.   CopyData.lpData := @TextMsg[1];
  31.   //Set the length field to indicate the number of characters in the memo
  32.   CopyData.cbData := Length(TextMsg);
  33.   //Send the message to the parent's window handle, as sent on the command-line
  34.   SendMessage(StrToInt(ParamStr(1)), wm_CopyData, Handle, Integer(@CopyData))
  35. end;
  36.  
  37. end.